<?php
/**
 * @version     1.0.0
 * @package     com_general
 * @copyright   Copyright (C) 2013. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      kent <kent@viseed.com> - http://viseed.com
 */
// no direct access
defined('_JEXEC') or die;

//Load admin language file
$lang = JFactory::getLanguage();
$lang->load('com_general', JPATH_ADMINISTRATOR);
$contact_info = get_article_info(6);
$app = JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();
if(isset($_POST['email'])){
	extract($_POST);
	$message = '';	
	$message .= 'Full Name: ' . $fullname . '<br />';
	$message .= 'Phone: ' . $phone . '<br />';
	$message .= 'Email: ' . $email . '<br />';
	$message .= 'Content: ' . $msg;
	$headers = 'From: '.$fullname.' <'.$email.'>' . "\r\n";
    $mailer = JFactory::getMailer();
    $mailer->setSender(array($email,'kent'));
    $recipient = array( 'khuong@viseed.com', 'quang@viseed.com', 'thang@viseed.com'); 
    $mailer->addRecipient($recipient);
    $mailer->setSubject('Contact Viseed');    
    $mailer->isHTML(true);
    $mailer->Encoding = 'base64';
    $mailer->setBody($message);
    $mailer->Send();    
}
?>
<script type="text/javascript" src="<?php echo JURI::base() . 'js/jquery.validate.js' ?>"></script>
<script type="text/javascript">
    // only for demo purposes
    jQuery.validator.setDefaults({
        submitHandler: function() {
            jQuery("#form1").submit();
        }
    });

    jQuery().ready(function($) {
        $("#form1").validate({
            errorLabelContainer: $("#form1 div.error")
        });
        $(".cancel").click(function() {
            validator.resetForm();
        });
    });
</script>
<div class="contact_map">
    <iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Tr%E1%BB%8Bnh+%C4%90%C3%ACnh+Tr%E1%BB%8Dng,+Ho+Chi+Minh+City,+Vietnam&amp;aq=0&amp;oq=Trinh+dinh&amp;sll=10.796211,106.677139&amp;sspn=0.018506,0.033023&amp;ie=UTF8&amp;hq=&amp;hnear=Tr%E1%BB%8Bnh+%C4%90%C3%ACnh+Tr%E1%BB%8Dng,+H%E1%BB%93+Ch%C3%AD+Minh,+Vietnam&amp;ll=10.775896,106.640978&amp;spn=0.009254,0.016512&amp;t=m&amp;z=14&amp;output=embed"></iframe></div>

<div class="content_detail">

    <div class="contact_header"><h1><?php echo JTEXT::_('CONTACT'); ?></h1></div>
    <div class="contact_title">
        <?php echo $contact_info->introtext; ?>
    </div>
    <div class="contact_form">
        <form class="cmxform" id="form1" name="form1" action="">
            <div class="error"></div>
            <input name="fullname" placeholder="<?php echo JTEXT::_('FULLNAME'); ?> (*)" id="fullname" title="<?php echo JTEXT::_('FULLNAME_REQUIRED'); ?>" required minlength="10" type="text"/>
            <input name="email" placeholder="Email (*)" id="email" title="<?php echo JTEXT::_('EMAIL_REQUIRED'); ?>" required type="email" />
            <input name="address" id="address" placeholder="<?php echo JTEXT::_('ADDRESS'); ?>" type="text" />
            <input name="phone" id="phone" placeholder="<?php echo JTEXT::_('PHONE'); ?>" type="text" />      
            <textarea name="msg" id="msg" title="<?php echo JTEXT::_('MESSAGE_REQUIRED'); ?>" placeholder="<?php echo JTEXT::_('MESSAGE'); ?> (*)" required cols="" rows=""></textarea>
            <input type="submit"  value="<?php echo JTEXT::_('SEND'); ?>" class="submit clear" />
        </form>
    </div>

</div>